package com.example.lending.ViewModel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.example.lending.Model.Book;
import com.example.lending.ViewModel.Repository.BookReposity;

import java.util.List;

public class BookViewModel extends AndroidViewModel {
    private BookReposity bookReposity;
    public BookViewModel(@NonNull Application application) {
        super(application);
        bookReposity = new BookReposity(application);
    }
    public void insertBooks(Book... books){bookReposity.insertBooks(books);}
    public void updataBooks(Book... books){bookReposity.updataBooks(books);}
    public void deleteBooks(Book... books){bookReposity.deleteBooks(books);}
    public void deleteAllBooks(Void... voids){deleteAllBooks();}
    public LiveData<List<Book>>getAllBooksLive(){return bookReposity.getAllBookLive();}
    public LiveData<List<Book>>findBookWithPattern(String a){return bookReposity.findBookWithPattern(a);}
}
